<?php

class Admin_Form_UpdateCity extends Zend_Form {

    public function init() {
        
    }

    public function main($info) {
        $this->setMethod('post');

        #name
        $name = new Zend_Form_Element_Text('name');
        $name->setLabel('City Name:')
                ->setRequired(true)
                ->setValue($info['name']);

        #state id
        $stateDb = new Ads_Model_State();
        $stateArray = $stateDb->fetchAll();
        $state = new Zend_Form_Element_Select('state');
        $state->setLabel('State Name:')
                ->setRequired(true)
                ->addValidator('Int')
                ->addMultiOption(-1, 'Select State')
                ->setValue($info['state_id']);
        foreach ($stateArray as $value) {
            $state->addMultiOption($value->id, $value->name);
        }

        #hidden
        $id = new Zend_Form_Element_Hidden('id');
        $id->setValue($info['id']);


        #submit
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Update')
                ->setAttribs(array('class' => 'btn btn-success'));


        $this->addElements(array($name, $state, $id, $submit));
    }

}

